package net.htjs.juc.chapter06.atomicinteger;

import lombok.extern.slf4j.Slf4j;

import java.util.concurrent.atomic.AtomicInteger;

@Slf4j
public class Test {

    public static void main(String[] args) {
        AtomicInteger i = new AtomicInteger(0);
        log.info("incrementAndGet:{}", i.incrementAndGet());
        log.info("GetAndincrement:{}", i.getAndIncrement());
        log.info("get:{}", i.get());
        log.info("addAndGet:{}", i.addAndGet(5));
        log.info("getAndAdd:{}", i.getAndAdd(5));
        i.updateAndGet(x -> x * 2);
        log.info("updateAndGet:{}", i.get());
        i.getAndUpdate(x -> x * 2);
        log.info("getAndUpdate:{}", i.get());
    }

}
